moduleApp.controller("LoginController",function($rootScope,$scope,$location,$http,$timeout){
    $scope.user = {};
    $scope.showBtn=true;
    $scope.userName="";
    $scope.showLoginContent=false;
    /*点击登录按钮*/
    $scope.showLogin=function(){
        $scope.showLoginContent=true;
    }
    $scope.closeLogin=function(){
        $scope.showLoginContent=false;
    }
    $scope.login = function(){
        $http({
            method  : 'POST',
            url     : $rootScope.basePath+'user/login.do',
            data    : $.param($scope.user),
            dataType: 'json',
            headers : {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        })
            .success(function(data) {
                if (data.status == 0) {
                    $scope.userName=data.data.username;
                    $scope.showBtn=false;
                    $scope.showLoginContent=false;
                }
                else {
                    alert(data.msg)
                }
            });
    };
})
